//
//  SKPWViewController.m
//  SouthKoreaDoorLock
//
//  Created by Umeinfo on 2018/1/18.
//  Copyright © 2018年 andy90s. All rights reserved.
//

#import "SKPWViewController.h"

@interface SKPWViewController () <UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>

@property (nonatomic, strong) UICollectionView *keypadList;
@property (nonatomic, strong) NSMutableArray *dataArray;

@end

@implementation SKPWViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupViews];
}

- (void)setupViews {
    [self.view addSubview:self.keypadList];
}

#pragma mark - CollectionView Delegate

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return self.dataArray.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"" forIndexPath:indexPath];
    return cell;
}

#pragma mark - lazy

- (UICollectionView *)keypadList {
    if (!_keypadList) {
        UICollectionViewFlowLayout *layout = [UICollectionViewFlowLayout new];
        layout.itemSize = CGSizeMake((self.view.bounds.size.width - 50 ) / 3, (self.view.bounds.size.width - 50 ) / 3);
        layout.minimumLineSpacing = 0;
        layout.minimumInteritemSpacing = 0;
        _keypadList = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 100, self.view.bounds.size.width - 50, self.view.bounds.size.height - 50) collectionViewLayout:layout];
        _keypadList.delegate = self;
        _keypadList.dataSource = self;
    }
    return _keypadList;
}

- (NSMutableArray *)dataArray {
    if (!_dataArray) {
        _dataArray = [NSMutableArray new];
    }
    return _dataArray;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
